<template>
	<view class="myuser">
		<scroll-view scroll-y="true" >
			<view class="top">
				<image :src="info.avatarUrl" mode=""></image>
				<view class="name">
					<image class="img" :src="info.avatarUrl" mode=""></image>
					<view>{{info.nickName}}</view>
				</view>
			</view>
			<!-- 店铺 -->
			<view class="title  box">
				<view class="title-it" v-for="item,index in list" :key="index">
					<view>{{item.num}}</view>
					<view>{{item.name}}</view>
				</view>
			</view>
			<!-- 我的订单 -->
			<view class="ding box">
				<view class="ding-top">我的订单</view>
				<view class="ding-it">
					<view class="ding-ite" v-for="item,index in list2" :key="index">
						<uni-icons type="contact" size="20"></uni-icons>
						<view>{{item.name}}</view>
					</view>
				</view>
			</view>
			<!-- 收货地址管理 -->
			<view class="box shou">
				收货地址管理
			</view>
			<!-- 客服 -->
			<view class="ke box">
				<view v-for="item,index in list3" :key="index" @tap="qie(index)">
					{{item}}
				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				info: {},
				list3: [
					'联系客服', '意见反馈', '关于我们','退出登录'
				],
				list2: [{
						name: '全部订单',
						icon: 0
					},
					{
						name: '待付款',
						icon: 0
					},
					{
						name: '待收货',
						icon: 0
					},
					{
						name: '退款/退货',
						icon: 0
					}
				],
				list: [{
						name: '收藏的店铺',
						num: 0
					},
					{
						name: '收藏的商品',
						num: 1
					},
					{
						name: '关注的商品',
						num: 0
					},
					{
						name: '我的足迹',
						num: 0
					},
				]
			};
		},
		onLoad() {
			this.info = uni.getStorageSync('info')
			// console.log(this.info);
		},
		methods:{
			qie(i){
				if(i==3){
					uni.removeStorageSync('token')
					uni.redirectTo({
						url:'/pages/login/login'
					})
				}
			}
		}
	}
</script>

<style lang="scss">
	.ke {
		margin-bottom: 20rpx;

		view {
			line-height: 50rpx;
			border-bottom: 1px solid #ccc;
			padding: 20rpx;
		}
	}


	.shou {
		height: 80rpx;
		line-height: 80rpx;
		padding-left: 20rpx;
	}

	.box {
		background-color: #fff;
		margin: 0 30rpx 30rpx 30rpx;
		font-size: 30rpx;
	}

	.title {
		height: 100rpx;
		display: flex;
		align-items: center;
		border-radius: 10rpx;

		.title-it {
			flex: 1;
			text-align: center;
		}
	}

	.ding {
		padding: 20rpx;

		.ding-top {
			border-bottom: 1rpx solid #ccc;
			padding-bottom: 10rpx;
		}

		.ding-it {
			display: flex;
			align-items: center;
			margin-top: 5rpx;

			.ding-ite {
				flex: 1;
				text-align: center;
			}
		}
	}

	.top {
		height: 500rpx;
		position: relative;

		image {
			width: 100%;
			height: 100%;
		}

		.name {
			position: absolute;
			left: 50%;
			top: 40%;
			transform: translate(-50%, -40%);
			text-align: center;

			.img {
				width: 150rpx;
				height: 150rpx;
				border-radius: 50%;
				background-color: #fff;
			}

			view {
				margin-top: 20rpx;
				color: #fff;
			}
		}
	}

	.myuser {
		height: 100vh;
		background-color: #edece8;
	}
</style>
